package com.spic.business.registrationform.service.impl;

import java.util.List;

import com.spic.business.registrationform.domain.ArchiveStaffRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spic.business.registrationform.mapper.ArchiveStaffWorkExperienceMapper;
import com.spic.business.registrationform.domain.ArchiveStaffWorkExperience;
import com.spic.business.registrationform.service.IArchiveStaffWorkExperienceService;

/**
 * 员工工作经历Service业务层处理
 * 
 * @author spic
 * @date 2022-07-20
 */
@Service
public class ArchiveStaffWorkExperienceServiceImpl implements IArchiveStaffWorkExperienceService 
{
    @Autowired
    private ArchiveStaffWorkExperienceMapper archiveStaffWorkExperienceMapper;

    /**
     * 查询员工工作经历
     * 
     * @param experienceId 员工工作经历主键
     * @return 员工工作经历
     */
    @Override
    public ArchiveStaffWorkExperience selectArchiveStaffWorkExperienceByExperienceId(Long experienceId)
    {
        return archiveStaffWorkExperienceMapper.selectArchiveStaffWorkExperienceByExperienceId(experienceId);
    }

    /**
     * 查询员工工作经历列表
     * 
     * @param archiveStaffWorkExperience 员工工作经历
     * @return 员工工作经历
     */
    @Override
    public List<ArchiveStaffWorkExperience> selectArchiveStaffWorkExperienceList(ArchiveStaffWorkExperience archiveStaffWorkExperience)
    {
        return archiveStaffWorkExperienceMapper.selectArchiveStaffWorkExperienceList(archiveStaffWorkExperience);
    }

    /**
     * 新增员工工作经历
     * 
     * @param archiveStaffWorkExperience 员工工作经历
     * @return 结果
     */
    @Override
    public int insertArchiveStaffWorkExperience(ArchiveStaffWorkExperience archiveStaffWorkExperience)
    {
        return archiveStaffWorkExperienceMapper.insertArchiveStaffWorkExperience(archiveStaffWorkExperience);
    }

    /**
     * 修改员工工作经历
     * 
     * @param archiveStaffWorkExperience 员工工作经历
     * @return 结果
     */
    @Override
    public int updateArchiveStaffWorkExperience(ArchiveStaffWorkExperience archiveStaffWorkExperience)
    {
        return archiveStaffWorkExperienceMapper.updateArchiveStaffWorkExperience(archiveStaffWorkExperience);
    }

    /**
     * 批量删除员工工作经历
     * 
     * @param experienceIds 需要删除的员工工作经历主键
     * @return 结果
     */
    @Override
    public int deleteArchiveStaffWorkExperienceByExperienceIds(Long[] experienceIds)
    {
        return archiveStaffWorkExperienceMapper.deleteArchiveStaffWorkExperienceByExperienceIds(experienceIds);
    }

    /**
     * 删除员工工作经历信息
     * 
     * @param experienceId 员工工作经历主键
     * @return 结果
     */
    @Override
    public int deleteArchiveStaffWorkExperienceByExperienceId(Long experienceId)
    {
        return archiveStaffWorkExperienceMapper.deleteArchiveStaffWorkExperienceByExperienceId(experienceId);
    }

    @Override
    public int deleteArchiveStaffWorkExperienceByStaffArchiveIds(String[] staffArchiveIds) {
        return archiveStaffWorkExperienceMapper.deleteArchiveStaffWorkExperienceByStaffArchiveIds(staffArchiveIds);
    }

    @Override
    public void importDataAtom(List<ArchiveStaffWorkExperience> list) {
        if (list == null || list.size() == 0) {
            return;
        }
        list.stream().forEach(workExperience -> {
            insertArchiveStaffWorkExperience(workExperience);
        });
    }
}
